package com.framework.base.service;

import com.framework.mybatis.mapper.CommonMapper;
import com.framework.base.entity.BaseEntity;
import com.framework.util.ResultHelper;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;

/**
 * 基础service,通过mapper提供基本操作方法
 *
 * @author LeeJun
 * @create 2017-08-10 15:40
 */
public abstract class BaseService<Mapper extends CommonMapper, T extends BaseEntity> {

	@Autowired
	protected Mapper mapper;

	public boolean save(T t){
		t.setCreateTime(LocalDateTime.now());
		return ResultHelper.retBool(mapper.insertSelective(t));
	}

}
